package process_demo.state;

/**
 * @author haomin
 * @date 2022/04/24 21:50
 **/

import java.util.concurrent.TimeUnit;

public class Main2 {
    static Object lock = new Object();

    static class MyThread extends Thread {
        @Override
        public void run() {
            synchronized (lock) {   // 永远请求不到锁 —— 死锁    BLOCKED
                System.out.println("永远到不了");
            }
        }
    }

    public static void main(String[] args) throws InterruptedException {
        synchronized (lock) {
            MyThread t = new MyThread();
            t.start();

            t.join();       // 等待的时候不会释放锁       WAITING
        }
    }
}
